package com.zzx.Util;

import com.zzx.bean.User;

import javax.servlet.http.HttpSession;

/**
 * @Author: Spider Man
 * @Description:
 * @Date Created in 2020-09-14 12:53
 * @Modified By:
 */
public class UserUtil {

    public static String createUsername(HttpSession session){
        return (String) session.getAttribute("adminUsername");
    }

    public static String createSysPhone(HttpSession session){
        return "12345678910";
    }

    public static String loginSms(HttpSession session,String uPhone){
        return (String) session.getAttribute(uPhone);
    }

    public static void setLoginSms(HttpSession session,String uPhone,String code){
        session.setAttribute(uPhone,code);
    }

    public static void setWxUser(HttpSession session, User user,boolean userInfo){
        session.setAttribute("wxUser",user);
        session.setAttribute("userInfo",userInfo);
    }

    public static User getWxUser(HttpSession session){
        return (User) session.getAttribute("wxUser");
    }

    public static Boolean getUserInfo(HttpSession session){
        return (Boolean) session.getAttribute("userInfo");
    }
}
